<template>
	<view class="user-withdraw-code">
		<view class="withdraw-code-container mt10">
			<view class="withdraw-code-contain">
				<navigator v-for="(item, index) in withdrawRecords" :key="index" class="withdraw-code-item bg-white"
					hover-class="none" :url="`/pages/bundle/widthdraw_result/widthdraw_result?id=${item.id}&type=1`">
					<view class="row-between">
						<view>提现至银行卡</view>

						<view class="flex">
							<!-- <text>￥</text> -->
							<priceFormat showSubscript :subScriptSize="26" :firstSize="36" :secondSize="36"
								:price="item.amount" />
						</view>

					</view>
					<view class="row-between mt10">
						<view class="muted xs time">{{item.requestTime}}</view>
						<view class="withdraw-status xs"
							:class="{'error-status' : item.auditStatus == 0 , 'common-status': item.auditStatus == 2}">
							{{item.auditStatus == 2 ?'提现成功':'审核中'}}
						</view>
					</view>
					<view class="primary mt10 line1 xs row-between">
						<view class="">
							订单号：{{item.withdrawalNo}}
						</view>
						<view class="">
							{{item.channel}}提现
						</view>

					</view>
				</navigator>
			</view>
			<view class="data-null column-center" v-if="withdrawRecords.length === 0">
				<image src="/static/images/order_null.png" class="img-null"></image>
				<text class="muted">暂无提现记录～</text>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		selectWithdrawalRecordApi
	} from '@/api/index.js';
	import priceFormat from '@/components/price-format/price-format.vue'
	export default {
		components: {
			priceFormat
		},
		data() {
			return {
				page: 1,
				withdrawRecords: []
			};
		},
		onLoad() {
			this.selectWithdrawalRecord();
		},
		methods: {
			// 查询提现记录
			async selectWithdrawalRecord() {
				const res = await selectWithdrawalRecordApi(uni.getStorageSync('UserInfo').userId);
				console.log(res, 'res-查询提现记录');
				if (res.code === 200) {
					this.withdrawRecords = res.data;
				} else {
					this.withdrawRecords = [];
				}
			}
		}
	}
</script>

<style lang="scss">
	.user-withdraw-code {
		.withdraw-code-container {
			.withdraw-code-item {
				padding: 24rpx 30rpx;

				.time {
					line-height: 32rpx;
				}

				.withdraw-status {
					color: #0CC21E;
				}

				.common-status {
					color: #666666;
				}

				.error-status {
					color: $-color-primary;
				}

				&:not(:last-of-type) {
					border-bottom: var(--border);
				}
			}
		}

		.data-null {
			padding-top: 200rpx;
		}
	}
</style>